<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function fn1() {
        console.log('Function 1');
      }
      // 异步
      function fn2() {
        setTimeout(() => {
          console.log('Function 2');
        }, 2000); 
        //即使改成0也是最后输出，因为是异步任务只有主线程任务执行完了空闲了才会去执行异步任务
      }

      function fn3() {
        console.log('Function 3');
      }
      fn1();
      fn2();
      fn3();

      // Function 1
      // Function 3
      // Function 2

    </script>
  </body>
</html>
